<?php
$this->breadcrumbs = array(
    'Contact' => array('index'),
    ' - Manager',
);
?>
<div class="box">
    <header>
        <div class="icons"><i class="icon-envelope"></i></div>
        <h5>Contact Manager</h5>
    </header>
    <div class="body">

        <?php
        $this->widget('bootstrap.widgets.TbGridView', array(
            'id' => 'contact-us-grid',
            'type'=>'bordered condensed striped',
            'dataProvider' => $model->search(),
            'filter' => $model,
            'columns' => array(
                'name',
                array(
                    'name' => 'email',
                    'header' => 'Email',
                    'type' => 'raw',
                    'value' => 'CHtml::link($data->email, array("/contactus/send", "email" => $data->email))'
                ),
                'phone',
                'subject',
                array(
                    'name' => 'create_time',
                    'type' => 'datetime'
                ),
                array(
                    'name' => 'readed',
                    'type' => 'raw',
                    'value' => '$data->readed==0?"New":"-"',
                    'filter' => array(
                        0 => 'Unread',
                        1 => 'Readed'
                    ),
                    'header' => 'Status'
                ),
                array(
                    //Button Group
                    'header' => 'Action',
                    'value' => function($data) {
                        app()->getController()->widget('bootstrap.widgets.TbButtonGroup', array(
                            'size' => 'mini',
                            'type' => 'inverse', // '', 'primary', 'info', 'success', 'warning', 'danger' or 'inverse'
                            'buttons' => array(
                                array(
                                    'icon' => 'align-right',
                                    'type' => '',
                                    'items' => array(
                                        array(
                                            'label' => 'View',
                                            'url' => url('contactus/view', array('id' => $data->id))
                                        ),
                                        array(
                                            'label' => 'Delete',
                                            'url' => url('contactus/delete', array('id' => $data->id)),
                                        ),
                                    ),
                                ),
                            ),
                        ));
                    }
//                    'class' => 'bootstrap.widgets.TbButtonColumn',
//                    'template' => '{view}{delete}'
                ),
            ),
        ));
        ?>
    </div>
</div>